#pragma once
#include "IBaseState.h"

#define NUM_FRAMES_TO_HOLD 200
class CMotionPlusCalibrateState : public IBaseState
{
	
	enum CalibrateStates {CALIB_FACEDOWN, CALIB_READING, CALIB_CALCULATE, CALIB_FINISHED, CALIB_TOTAL};
	
	vec3<float> ThisFramesReading;
	vec3<float> MotionPlusData[NUM_FRAMES_TO_HOLD];
	vec3<float> FinalMotionPlusData;
	
	int m_nCurrentFrame;
	int m_nCounter;
	bool m_bFinished;
	DWORD m_dwLastTime;
	CalibrateStates m_CurState;
	std::string m_szStatus;

public:
	CMotionPlusCalibrateState(void);
	~CMotionPlusCalibrateState(void);
	
	void Enter();
	void Input(CRetroInput* pInput);
	void Update(float fDeltaTime);
	void Render(CDirect3D* pRender);
	void Exit();
	inline StateType Type() { return STATE_MOTIONPLUSCALIBRATE;}
};

